﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CardLib1
{

    public class Cards:CollectionBase,ICloneable
    {
        public void Add(Card card)=>List.Add(card);
        public void Remove(Card card)=>List.Remove(card);

        public Card this[int index]
        {
            get { return (Card)List[index]; }
            set { List[index] = value; }
        }

        public void CopyTo(Cards DCards)
        {
            for (int i = 0; i < this.Count; i++)
            {
                DCards[i] = this[i];
            }
        }

        public bool Contains(Card card) => InnerList.Contains(card);

        public object Clone()
        {
            Cards DCards = new Cards();
            foreach (Card card in List) {
                DCards.Add((Card)card.Clone());
            }
            return DCards;

        }
    }
}
